package com.funtonow.jqdk.adapter;

import android.widget.ImageView;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.funtonow.jqdk.R;
import com.funtonow.jqdk.bean.GameThirdInfoListBean;
import com.funtonow.jqdk.utils.GlideUtils;
import com.funtonow.jqdk.utils.PhoneUtils;

import java.util.Locale;

/**
 * @author Jiajien
 * @date 2019/6/17
 */
public class LoanListAdapter extends BaseQuickAdapter<GameThirdInfoListBean, BaseViewHolder> {


    public LoanListAdapter() {
        super(R.layout.item_loan_layout);
    }

    @Override
    protected void convert(BaseViewHolder helper, GameThirdInfoListBean item) {
        ImageView ivLoanImg = helper.getView(R.id.iv_loan_img);

        GlideUtils.setHeadImg(ivLoanImg, item.getIcon());
        helper.setText(R.id.tv_loan_money, String.format(Locale.getDefault(), "%s~%s", PhoneUtils.getEduMax(item.getEdu()), PhoneUtils.getEduMax(item.getEdumax())));

        if (item.getSlogan().contains("#")) {
            helper.setText(R.id.tv_loan_content, item.getSlogan().split("#")[0]);
        } else {
            helper.setText(R.id.tv_loan_content, item.getSlogan());
        }
        String s = item.getFeilv() + " | " + item.getWeixin();
        helper.setText(R.id.tv_lx, s);
        long applyNum = (System.currentTimeMillis() - item.getCreatetime()) / 60000 * 5234;
        helper.setText(R.id.tv_register, "" + applyNum + "个人申请过");
        if (item.getVipfw() == 1) {
            helper.setImageResource(R.id.iv_apply, R.mipmap.btn_apply_vip);
            helper.setText(R.id.tv_loan_name, String.format(mContext.getResources().getString(R.string.vip_name), item.getName()));
        } else {
            helper.setImageResource(R.id.iv_apply, R.mipmap.btn_apply);
            helper.setText(R.id.tv_loan_name, item.getName());
        }

    }


}
